package com.chushouya.order.constants;


import com.general.framework.core.enums.IEnum;
import com.general.framework.core.exception.Ex;

import java.util.Objects;

public enum AlipaySpiResultCodeEnum implements IEnum<String> {

    SUCCESS("10000", "Success"),
    FAIL("40004", "Business Failed");

    private String value;

    private String desc;

    AlipaySpiResultCodeEnum(String value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public static AlipaySpiResultCodeEnum get(String value) {
        for (AlipaySpiResultCodeEnum thisEnum : AlipaySpiResultCodeEnum.values()) {
            if (Objects.equals(thisEnum.value, value)) {
                return thisEnum;
            }
        }
        throw Ex.systemError("未定义的枚举[{}]", value);
    }


    @Override
    public String value() {
        return this.value;
    }

    @Override
    public String named() {
        return this.desc;
    }
}
